<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>商品</title>
        <link rel="stylesheet" href="cartStyle.css">
    </head>
    <body>
        <div class="content">
            <div class="logo">
                <img src="img/dd_logo.jpg" />
                <span onclick="close_plan()">关闭</span>
            </div>
            <div class="cartList" id="cartList">
                <ul>
                <li>¥<input type="text" name="price" value="21.90"></li>
                <li><input type="button" name="minus" value="-" onclick="minus(0);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(0);"></li>
                <li id="price0">¥19.9=00</li>
                <li><p  onclick="collection();">移入收藏</p ><p onclick="del();">删除</p ></li>
                </ul>
                <ul>
               <li>¥<input type="text" name="price" value="24.00"></li>
               <li><input type="button" name="minus" value="-" onclick="minus(1);"><input type="text" name="amount" value="1"><input type="button" name="plus" value="+" onclick="plus(1);"></li>
               <li id="price1">¥24.00</li>
               <li><p  onclick="collection();">移入收藏</p ><p onclick="del();">删除</p ></li>
               </ul>
               <ol>
               <li id="totalPrice">&nbsp;</li>
               <li><span onclick="accounts();">结 算</span></li>
              </ol>
            </div>
            <div></div>
        </div>
        <script type="text/javascript" src="shopping.js"></script>
        <script type="text/javascript">                                  //这里的js可以放到js包下使用
            function accounts(){
                var num1=document.getElementById("cartList").firstElementChild.firstElementChild.nextElementSibling.nextElementSibling.innerHTML||document.getElementById("cartList").firstChild.firstChild.nextSibling.nextSibling.innerHTML;
                var num2=document.getElementById("cartList").firstElementChild.nextElementSibling.lastElementChild.previousElementSibling.innerHTML||document.getElementById("cartList").firstChild.nextSibling.lastChild.previousSibling.innerHTML
                var total=document.getElementById("cartList").lastElementChild.firstElementChild.innerHTML||document.getElementById("cartList").lastChild.firstChild.innerHTML;
        var str="您本次购买的商品信息如下：<br/>白岩松：白说："+num1+"<br/>岛上书店："+num2+"<br/>商品共计："+total;
        document.getElementById("cartList").nextElementSibling.innerHTML=str;
        }
        </script>
    </body>
</html>